﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CSP.Dao.IObjectDaos.CSP;
using CSP.Dao.CommonDao;
using CSP.DataAccess;
using CSP.Model.CSP;

namespace CSP.Dao.ObjectDaos.CSP
{
    public class RecommendDao : CSPCommonDao, IRecommendDao
    {
        public RecommendDao(CSPContext context, bool isTransaction = false)
            : base(context, isTransaction)
        {

        }

        public ICollection<Model.CSP.Recommend> FindAll()
        {
            return _context.Recommends.ToArray();
        }

        public Model.CSP.Recommend GetDataById(int id)
        {
            throw new NotImplementedException();
        }

        public ICollection<Model.CSP.Recommend> GeDatatByIds(int[] Ids)
        {
            throw new NotImplementedException();
        }

        public void Add(Model.CSP.Recommend obj)
        {
            throw new NotImplementedException();
        }

        public void Update(Model.CSP.Recommend obj)
        {
            throw new NotImplementedException();
        }

        public Model.CSP.Recommend DeleteById(int id)
        {
            throw new NotImplementedException();
        }


        public Model.CSP.Recommend[] GetRecommendByRecommendType(Model.CSPEnum.RecommendType recommendType)
        {
            var temRecommends = _context.Recommends.Where(r => r.RecommendType == (int)recommendType);
            Recommend[] result =new Recommend[0];
            if(temRecommends.Count()!=0)
            {
                result=temRecommends.ToArray();
            }
            
            return result;
        }

    }
}
